var mySingleSelect = mySingleSelect == undefined || mySingleSelect == true ? true : false;

// lists
$(function() {
	if (urllist != "" && urllist != null) {
		if(urllist == "##") {
			urllist = "";
		}
		$("#" + dg).datagrid({
			style : "width:100%;height:100%",
			url : urllist,
			toolbar : "#" + toolbar,
			pagination : true,
			pageNumber : 1,
			pageSize : 20,
			pageList : pageList,
			rownumbers : true,
			fitColumns : true,
			singleSelect : mySingleSelect,
			columns : [ paginationColumns ],
			onLoadError : function(XMLHttpRequest, textStatus, errorThrown) {
				var json = XMLHttpRequest.responseText;
				var obj = eval('(' + json + ')');
				$.messager.alert('异常提示', obj.msg, 'warning');
			}
		});
		$(".window_table tr").each(function() {
			var $thisTr = $(this);
			var $thisFirstTd = $("td:eq(0)", $thisTr);
			$thisFirstTd.attr({
				align : "right",
				width : "30%"
			});
		});
	}
});
mySingleSelect = undefined;

function openDetail(dialogId, current, urldetail) {
	var row = $("#dg" + current).datagrid("getSelected");
	if (row) {
		// $("#" + dialogId + current).dialog({
		// onBeforeOpen:function(){
		// //设置ajax的get方法为同步，以便相应的模块根据需要，对详情页面再进行设置
		// $.ajax({
		// type : "post",
		// url : urldetail + "?id=" + row.id,
		// async : false,
		// success : function(result){
		// eachJsonByData(current ,result,null);
		// }
		// });
		// }
		// });
		var isSuccess = true;
		$.ajax({
			type : "get",
			url : urldetail + "?id=" + row.id,
			async : false,
			success : function(result) {
				try {
					var rs = eval("(" + result + ")");
					if (rs.success == false) {
						$.messager.alert('提示', rs.msg, 'warning');
						isSuccess = false;
					}
				} catch (ee) {
				}
				eachJsonByData(current, result, null);
				var lists = $("tr[id*='expand" + current + "']");
				lists.each(function(index,item){
					item.style.display = 'none'; 
				});
				try {
					window["detailSet" + current](result);
				} catch (ee) {
				}
			},
			error : function() {
				// 请求出错处理
				$.messager.alert('提示', '出现异常，请稍后再试.', 'warning');
			}
		});
		// $.get(urldetail + "?id=" + row.id, function(result) {
		// eachJsonByData(current ,result,null);
		// });
		if (isSuccess)
			$("#" + dialogId + current).dialog("open").dialog("setTitle", detailTitle);
	} else {
		$.messager.alert('提示', '请先选择一行数据，再查看详情.', 'warning');
	}
}

/**
 * 详情页使用，迭代整个详情对象，与label名称相符的赋值
 * 
 * @param current
 * @param json
 * @param parent
 */
function eachJsonByData(current, json, parent) {
	$.each(json, function(name, value) {
		var key = "";
		if (parent != null) {
			key = parent + "_" + name;
		} else {
			key = name;
		}
		// if (value != null) {
		if (value != null && typeof (value) == "object") {
			eachJsonByData(current, value, key);
		} else {
			try {
				// alert(key + " --- > " + value);
				if (value != null) {
					if (isNaN(value))
						value = value.replace(/\r\n/g, '<br/>');
					$("#" + key + current).html(value);
				} else {
					$("#" + key + current).text("");
				}

			} catch (b) {
			}
		}
		// }
	});
}

function setToKen(current){
	if ( $("#" + token).length > 0 ) {
		$.get(urltoken, function(result) {
			try {
				$('#' + token).attr("value", result);
			} catch (e) {
			}
		});
	}
	if ( $("#" + token2).length > 0 ) {
		$.get(urltoken2, function(result) {
			try {
				$('#' + token2).attr("value", result);
			} catch (e) {
			}
		});
	}
	if ( $("#" + token3).length > 0 ) {
		$.get(urltoken3, function(result) {
			try {
				$('#' + token3).attr("value", result);
			} catch (e) {
			}
		});
	}
}

// save
function openAdd(dialogId, fm, current, urlsave, urladdforminit) {
	try{
		$("#dg" + current).datagrid("clearSelections");
		$("#" + fm + current).form('clear');
		//$("#" + dialogId + current).dialog("open").dialog("setTitle", saveTitle);
		
		$("#" + dialogId + current).dialog({
			modal:true
		}).dialog("open").dialog("setTitle", saveTitle);
		if (urladdforminit != null && urladdforminit != "") {
			$("#" + fm + current).form("myLoad", urladdforminit);
		}
		setToKen(current);
		url = urlsave;
		//window["addSet" + current]();
		
		var oResult = null;
		try {
			$.ajax({
				type : "get",
				url : urladdforminit,
				async : false,
				success : function(result) {
					oResult = result;
				}
			});
			window["addSet" + current](oResult);
		} catch (ee) {
		}
	} catch(ee){
	}
	
}

function save(dialogId, fm, current, urlsave, urlupdate) {
	var url = urlsave;
	try {
		var row = $("#dg" + current).datagrid("getSelected");
		if (row && urlupdate.length>0) {
			url = urlupdate + "?id=" + row.id;
		}
	} catch (e) {
	}
	// $("#dg" + current).datagrid("clearSelections");
	$("#" + fm + current).form("submit", {
		url : url,
		onSubmit : function() {
			var vd = $(this).form("validate");
			return vd;
		},
		success : function(result) {
			if (result != null && result.length > 0) {
				result = eval("(" + result + ")");

				if (result.success) {
					// $("#fm" + current).form("clear");
					$("#" + dialogId + current).dialog("close"); // close the
					// dialog
					$("#dg" + current).datagrid("reload"); // reload the user
					// data
				} else {
					if (result.msg != null) {
						$.messager.alert('异常提示', result.msg, 'error');
					} else {
						$.messager.alert('异常提示', '提交出现异常，请检查您的输入项，或与管理员联系', 'error');
					}
				}
			} else {
				$.messager.alert('异常提示', '提交出现异常，请检查您的输入项，或与管理员联系', 'error');
			}
		},
		onLoadError : function(XMLHttpRequest) {
			$.messager.alert('异常提示', XMLHttpRequest.responseText, 'warning');
		}
	});
}


function impMonthCardExcel(dialogId, fm, current, urlsave) {
	var url = urlsave;
	
	// $("#dg" + current).datagrid("clearSelections");
	$("#" + fm + current).form("submit", {
		url : url,
		onSubmit : function() {
			var vd = $(this).form("validate");
			return vd;
		},
		success : function(result) {
			if (result != null && result.length > 0) {
				result = eval("(" + result + ")");

				if (result.success) {
					$.messager.alert('提示', result.msg, 'info');
					// $("#fm" + current).form("clear");
					$("#" + dialogId + current).dialog("close"); // close the
					// dialog
					$("#dg" + current).datagrid("reload"); // reload the user
					// data
				} else {
					if (result.msg != null) {
						$.messager.alert('异常提示', result.msg, 'error');
					} else {
						$.messager.alert('异常提示', '提交出现异常，请检查您的输入项，或与管理员联系', 'error');
					}
				}
			} else {
				$.messager.alert('异常提示', '提交出现异常，请检查您的输入项，或与管理员联系', 'error');
			}
		},
		onLoadError : function(XMLHttpRequest) {
			$.messager.alert('异常提示', XMLHttpRequest.responseText, 'warning');
		}
	});
}
/**
 * 不刷新列表打开编辑页面
 * 
 * @param dialogId
 * @param fm
 * @param current
 * @param urlsave
 * @param urladdforminit
 */
function openAddFm(dialogId, fm, current, urlsave, urladdforminit, saveTitle) {
	$("#" + fm + current).form('clear');
	$("#" + dialogId + current).dialog("open").dialog("setTitle", saveTitle);
	if (urladdforminit != null && urladdforminit != "") {
		$("#" + fm + current).form("myLoad", urladdforminit);
	}
	setToKen(current);
	url = urlsave;
}
/**
 * 不刷新列表保存
 * 
 * @param dialogId
 * @param fm
 * @param current
 * @param urlsave
 */
function saveFm(dialogId, fm, current, urlsave) {
	var url = urlsave;
	$("#" + fm + current).form("submit", {
		url : url,
		onSubmit : function() {
			var vd = $(this).form("validate");
			return vd;
		},
		success : function(result) {
			result = eval("(" + result + ")");
			if (result != null) {
				if (result.success) {
					// $("#fm" + current).form("clear");
					$.messager.alert('完成提示', "成功完成操作", 'info');
					$("#" + dialogId + current).dialog("close"); // close the
					// dialog
				} else {
					if (result.msg != null) {
						$.messager.alert('异常提示', result.msg, 'error');
					} else {
						$.messager.alert('异常提示', '提交出现异常，请检查您的输入项，或与管理员联系', 'error');
					}
				}
			}
		},
		onLoadError : function(XMLHttpRequest) {
			$.messager.alert('异常提示', XMLHttpRequest.responseText, 'warning');
		}
	});
}

function cancelForm(dialogId, formId, current) {
	if (formId != null)
		$("#" + formId + current).form('clear');
	$("#" + dialogId + current).dialog("close");
}

// update
function openEdit(dialogId, fm, current, urlupdate, urldetail) {
	var row = $("#dg" + current).datagrid("getSelected");
	$("#" + fm + current).form('clear');
	if (row) {
		//$("#" + dialogId + current).dialog("open").dialog("setTitle", updateTitle);
		
		$("#" + dialogId + current).dialog({
			modal:true
		}).dialog("open").dialog("setTitle", updateTitle);
		
		var isGet = false;
		if (urldetail == null) {
			$("#" + fm + current).form("myLoad", row);
		} else {
			$("#" + fm + current).form("myLoad", urldetail + "?id=" + row.id);
			isGet = true;
		}
		setToKen(current);
		try {
			var oResult = row;
			if (isGet == true) {
				$.ajax({
					type : "get",
					url : urldetail + "?id=" + row.id,
					async : false,
					success : function(result) {
						oResult = result
					}
				});
			}
			window["editSet" + current](oResult);
		} catch (ee) {
		}
		url = urlupdate + "?id=" + row.id;
	} else {
		$.messager.alert('提示', '请先选择一行数据，再进行编辑操作.', 'warning');
	}
}

//invoiceAdd
function openInvoiceAdd(dialogId, fm, current, urladd, urldetail) {
	var row = $("#dg" + current).datagrid("getSelected");
	$("#" + fm + current).form('clear');
	if (row) {
		$("#" + dialogId + current).dialog({
			modal:true
		}).dialog("open").dialog("setTitle", updateTitle);
		
		var isGet = false;
		if (urldetail == null) {
			$("#" + fm + current).form("myLoad", row);
		} else {
			$("#" + fm + current).form("myLoad", urldetail + "?id=" + row.parkingPlace.id+ "&parkRecordId=" + row.id);
			isGet = true;
		}
		setToKen(current);
		url = urladd;
		try {
			var oResult = row;
			if (isGet == true) {
				$.ajax({
					type : "get",
					url : urldetail +"?id="+row.parkingPlace.id+ "&parkRecordId=" + row.id ,
					async : false,
					success : function(result) {
						oResult = result
					}
				});
			}
			window["addSet" + current](oResult);
		} catch (ee) {
		}
	} else {
		$.messager.alert('提示', '请先选择一行数据，再进行开具发票操作.', 'warning');
	}
}


// delete
function openDelete(current, urldelete) {
	var row = $("#dg" + current).datagrid("getSelected");
	if (row) {
		$.messager.confirm("请确认", deleteConfirm, function(r) {
			if (r) {
				$.post(urldelete, {
					id : row.id
				}, function(result) {
					if (result.success) {
						$("#dg" + current).datagrid("reload"); // reload the
						// user data
					} else {
						if (result.msg != null) {
							$.messager.alert('异常提示', result.msg, 'error');
						} else {
							$.messager.alert('异常提示', '提交出现异常，请检查您的选择，或与管理员联系', 'error');
						}
					}
				}, "json").error(function(XMLHttpRequest) {
					var json = XMLHttpRequest.responseText;
					var obj = eval('(' + json + ')');
					$.messager.alert('异常提示', obj.msg, 'warning');
					// $.messager.alert('异常提示', XMLHttpRequest.responseText,
					// 'warning');
				});
			}
		});
	} else {
		$.messager.alert('提示', '请先选择一行数据，再进行删除操作.', 'warning');
	}
}

// delete
function openRenew(current, urlrenew) {
	var row = $("#dg" + current).datagrid("getSelected");
	if (row) {
		$.messager.confirm("请确认", renewConfirm, function(r) {
			if (r) {
				$.post(urlrenew, {
					id : row.id
				}, function(result) {
					if (result.success) {
						$("#dg" + current).datagrid("reload"); // reload the
						// user data
					} else {
						if (result.msg != null) {
							$.messager.alert('异常提示', result.msg, 'error');
						} else {
							$.messager.alert('异常提示', '提交出现异常，请检查您的选择，或与管理员联系', 'error');
						}
					}
				}, "json").error(function(XMLHttpRequest) {
					$.messager.alert('异常提示', XMLHttpRequest.responseText, 'warning');
				});
			}
		});
	} else {
		$.messager.alert('提示', '请先选择一行数据，再进行恢复操作.', 'warning');
	}
}

function myformatter(date) {
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	var d = date.getDate();
	return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
}
function myparser(s) {
	if (!s)
		return new Date();
	var ss = (s.split('-'));
	var y = parseInt(ss[0], 10);
	var m = parseInt(ss[1], 10);
	var d = parseInt(ss[2], 10);
	if (!isNaN(y) && !isNaN(m) && !isNaN(d)) {
		return new Date(y, m - 1, d);
	} else {
		return new Date();
	}
}

function getEntityProperty(data, property) {
	try {
		return eval("data['" + property.replace(/\_/g, "']['") + "']");
	} catch (e) {
		return "";
	}
}

function openLastUpdateOperationLog(className, pk) {
	$("#lastUpdateOperationLog").dialog("open").dialog("setTitle", "最后操作日志");

	var pcs = [ {
		field : 'fieldName',
		title : "列名",
		width : 50
	}, {
		field : 'fieldDesc',
		title : "列描述",
		width : 50
	}, {
		field : 'oldValue',
		title : "修改前的值",
		width : 100
	}, {
		field : 'newValue',
		title : "修改后的值",
		width : 100
	}, {
		field : 'createdate',
		title : "时间",
		width : 55
	} ];

	$('#lastUpdateOperationLogData').datagrid({
		url : urllastupdatelog + "?operationClass=" + className + "&pk=" + pk,
		style : "width:100%;height:100%",
		fitColumns : "true",
		columns : [ pcs ],
		onLoadError : function(XMLHttpRequest, textStatus, errorThrown) {
			var json = XMLHttpRequest.responseText;
			var obj = eval('(' + json + ')');
			$.messager.alert('异常提示', obj.msg, 'warning');
		}
	});
}

// pcs 列数组
// url 地址
// dialogId
// dialogTitle
// datagrId
function openDialogDatagrid(pcs, url, dialogId, dialogTitle, datagrId) {
	$("#" + dialogId).dialog("open").dialog("setTitle", dialogTitle);

	$('#' + datagrId).datagrid({
		url : url,
		style : "width:100%;height:100%",
		fitColumns : "true",
		columns : [ pcs ],
		pagination : true,
		pageNumber : 1,
		onLoadError : function(XMLHttpRequest, textStatus, errorThrown) {
			var json = XMLHttpRequest.responseText;
			var obj = eval('(' + json + ')');
			$.messager.alert('异常提示', obj.msg, 'warning');
		},
		onLoadSuccess : function(data) {
			// alert(data)
		}
	});
}

function openAttachmentDetail(className, current, fileAliasName) {
	var row = $("#dg" + current).datagrid("getSelected");
	if (row) {
		var params = "?pk=" + row.id + "&className=" + className;
		if (fileAliasName.length > 0) {
			params += "&fileAliasNameFuzzRightSearchKey=" + fileAliasName;
		}
		$.ajax({
			type : "get",
			url : urlattachmentView + params,
			async : false,
			success : function(result) {
				var str = "";
				for (var i = 0; i < result.length; i++) {
					var f = result[i].fileName;
					if(f==null){
						f = encodeURIComponent(result[i].fileAliasName);
					}
					if(f.endWith("jpg")){
						str += "<img src='" + contextPath + "/file/view/" + f + "'/> <br />";
					}
					
				}
				$("#attachmentViewItem").html(str);
			}
		});
		// $.get(urldetail + "?id=" + row.id, function(result) {
		// eachJsonByData(current ,result,null);
		// });
		$("#attachmentView").dialog("open").dialog("setTitle", "查看附件");
	} else {
		$.messager.alert('提示', '请先选择一行数据，再查看详情.', 'warning');
	}
}
function openAttachmentByPkDetailVideo(className,current) {
	var row = $("#dg" + current).datagrid("getSelected");
	if (row) {
		var params = "?pk=" + row.id + "&className=" + className;
		
		$.ajax({
			type : "get",
			url : urlattachmentView + params,
			async : false,
			success : function(result) {
				var str = "";
				for (var i = 0; i < result.length; i++) {
					if(result[i].fileName.endWith("mp4")){
						//str += "<video src='" + contextPath + "/1590969896772.mp4' autoplay=\"true\" controls=\"controls\"/> <br />";
						str+="<video controls=\"controls\" preload=\"auto\" autoplay=\"true\"><source src='" + contextPath + "/file/viewVideo/" + result[i].fileName + "' type=\"video/mp4\"></video>"
						//str+="<embed pluginspage=\"http://www.apple.com/quicktime/download/\" src='" + contextPath + "/1590969896772.mp4' type=\"application/MPEG-4 Video File\" wmode=\"transparent\" autostart=\"True\" loop=\"True\" controller=\"True\"/>"
						//str+="<object type='video/quicktime' data='" + contextPath + "/1590969896772.mp4'></object>"
					}
					
				}
				$("#attachmentViewItem").html(str);
			}
		});
		// $.get(urldetail + "?id=" + row.id, function(result) {
		// eachJsonByData(current ,result,null);
		// });
		$("#attachmentView").dialog("open").dialog("setTitle", "查看附件");
	}else {
		$.messager.alert('提示', '请先选择一行数据，再查看详情.', 'warning');
	}
	
}
function openAttachmentByPkDetail(pk, className, current, fileAliasName) {
	var params = "?pk=" + pk + "&className=" + className;
	if (fileAliasName.length > 0) {
		params += "&fileAliasNameFuzzRightSearchKey=" + fileAliasName;
	}
	$.ajax({
		type : "get",
		url : urlattachmentView + params,
		async : false,
		success : function(result) {
			var str = "";
			for (var i = 0; i < result.length; i++) {
				if(result[i].fileName.endWith("mp4")){
					//str += "<video src='" + contextPath + "/1590969896772.mp4' autoplay=\"true\" controls=\"controls\"/> <br />";
					str+="<video controls=\"controls\" preload=\"auto\" autoplay=\"true\"><source src='" + contextPath + "/file/viewVideo/" + result[i].fileName + "' type=\"video/mp4\"></video>"
					//str+="<embed pluginspage=\"http://www.apple.com/quicktime/download/\" src='" + contextPath + "/1590969896772.mp4' type=\"application/MPEG-4 Video File\" wmode=\"transparent\" autostart=\"True\" loop=\"True\" controller=\"True\"/>"
					//str+="<object type='video/quicktime' data='" + contextPath + "/1590969896772.mp4'></object>"
				}else{
					str += "<img src='" + contextPath + "/file/view/" + result[i].fileName + "' /> <br />"
				}
				
			}
			$("#attachmentViewItem").html(str);
		}
	});
	// $.get(urldetail + "?id=" + row.id, function(result) {
	// eachJsonByData(current ,result,null);
	// });
	$("#attachmentView").dialog("open").dialog("setTitle", "查看附件");
}
function openAttachmentByPkVideo(pk, className, current, fileAliasName) {
	var params = "?pk=" + pk + "&className=" + className;
	if (fileAliasName.length > 0) {
		params += "&fileAliasNameFuzzRightSearchKey=" + fileAliasName;
	}
	$.ajax({
		type : "get",
		url : urlattachmentView + params,
		async : false,
		success : function(result) {
			var str = "";
			for (var i = 0; i < result.length; i++) {
				if(result[i].fileName.endWith("mp4")){
					//str += "<video src='" + contextPath + "/1590969896772.mp4' autoplay=\"true\" controls=\"controls\"/> <br />";
					str+="<video controls=\"controls\" preload=\"auto\" autoplay=\"true\"><source src='" + contextPath + "/file/viewVideo/" + result[i].fileName + "' type=\"video/mp4\"></video>"
					//str+="<embed pluginspage=\"http://www.apple.com/quicktime/download/\" src='" + contextPath + "/1590969896772.mp4' type=\"application/MPEG-4 Video File\" wmode=\"transparent\" autostart=\"True\" loop=\"True\" controller=\"True\"/>"
					//str+="<object type='video/quicktime' data='" + contextPath + "/1590969896772.mp4'></object>"
				}
				
			}
			$("#attachmentViewItem").html(str);
		}
	});
	// $.get(urldetail + "?id=" + row.id, function(result) {
	// eachJsonByData(current ,result,null);
	// });
	$("#attachmentView").dialog("open").dialog("setTitle", "查看附件");
}

/**
 * 改写form load，使之支持子属性
 */
$.extend($.fn.form.methods, {
	myLoad : function(jq, param) {
		return jq.each(function() {
			load(this, param);
		});

		function load(target, param) {
			if (!$.data(target, "form")) {
				$.data(target, "form", {
					options : $.extend({}, $.fn.form.defaults)
				});
			}
			var options = $.data(target, "form").options;
			if (typeof param == "string") {
				var params = {};
				if (options.onBeforeLoad.call(target, params) == false) {
					return;
				}
				$.ajax({
					url : param,
					data : params,
					async : false,
					dataType : "json",
					success : function(rsp) {
						loadData(rsp);
					},
					error : function() {
						options.onLoadError.apply(target, arguments);
					}
				});
			} else {
				loadData(param);
			}
			function loadData(dd) {
				var form = $(target);
				var formFields = form.find("input[name],select[name],textarea[name]");
				formFields.each(function() {
					try {
						var name = this.name;
						var value = jQuery.proxy(function() {
							try {
								return eval('this.' + name);
							} catch (e) {
								return "";
							}
						}, dd)();
						var rr = setNormalVal(name, value);
						if (!rr.length) {
							var f = form.find("input[numberboxName=\"" + name + "\"]");
							if (f.length) {
								f.numberbox("setValue", value);
							} else {
								var tn = form.find("input[textboxName=\"" + name + "\"]");
								if (tn.length) {
									tn.textbox("setText", value);
									tn.textbox("setValue", value);
								} else {
									$("input[name=\"" + name + "\"]", form).val(value);
									$("textarea[name=\"" + name + "\"]", form).val(value);
									$("select[name=\"" + name + "\"]", form).val(value);
								}
							}
						}
						setPlugsVal(name, value);
					} catch (ex) {
					}
				});
				options.onLoadSuccess.call(target, dd);
				$(target).form("validate");
			}
			;
			function setNormalVal(key, val) {
				var rr = $(target).find(
						"input[name=\"" + key + "\"][type=radio], input[name=\"" + key + "\"][type=checkbox]");
				rr._propAttr("checked", false);
				rr.each(function() {
					var f = $(this);
					if (f.val() == String(val) || $.inArray(f.val(), val) >= 0) {
						f._propAttr("checked", true);
					}
				});
				return rr;
			}
			;
			function setPlugsVal(key, val) {
				if (val == null) {
					val = "";
				}
				var form = $(target);
				var cc = [ "combobox", "combotree", "combogrid", "datetimebox", "datebox", "combo" ];
				var c = form.find("[comboName=\"" + key + "\"]");
				if (c.length) {
					for (var i = 0; i < cc.length; i++) {
						var combo = cc[i];
						if (c.hasClass(combo + "-f")) {
							if (c[combo]("options").multiple) {
								c[combo]("setValues", val);
							} else {
								c[combo]("setValue", val + "");
							}
							return;
						}
					}
				}
			}
			;
		}
		;
	}
});

String.prototype.startWith = function(str) {
	var reg = new RegExp("^" + str);
	return reg.test(this);
}
// 测试ok，直接使用str.endWith("abc")方式调用即可
String.prototype.endWith = function(str) {
	var reg = new RegExp(str + "$");
	return reg.test(this);
}

function dayDiff(d1, d2) {
	var time1 = Date.parse(d1);
	var time2 = Date.parse(d2);
	var dayCount = (time2 - time1) / 1000 / 60 / 60 / 24;
	return dayCount;
}

function openXor(dialogId, fm, current, urlsave) {
	$("#dg" + current).datagrid("clearSelections");
	$("#" + fm + current).form('clear');
	$("#" + dialogId + current).dialog("open").dialog("setTitle", "核对");
	setToKen(current);
	url = urlsave;
}